package com.yxym.homework09;
//创建Student类，分别有该类属性和方法，通过构造器在创建对象时将其属性赋值
public class Student extends Person {
    //属性
    private String stu_id;
    //构造器
    public Student(String name, char sex, int age, String stu_id) {
       super(name,sex,age);
        this.stu_id = stu_id;
    }

    public String getStu_id() {
        return stu_id;
    }

    public void setStu_id(String stu_id) {
        this.stu_id = stu_id;
    }
    public void study(){
        System.out.println(getName() + "我承诺,我会好好学习java");
    }

    @Override
    public String play() {
        return super.play() + "足球";
    }
    //输出信息方法
     /*
    姓名；.....
    年龄；.....
    性别；....

     */
    public void  printInfo(){
        System.out.println("学生信息" + "\n" + basicPrint());
        System.out.println("学号：" + stu_id);
        System.out.println(play());
    }

    @Override
    public String toString() {
        return "Student{" +
                "stu_id='" + stu_id + '\'' +
                '}' + super.toString();
    }
}
